package com.parkingspace.controller;


import com.parkingspace.entity.Property;
import com.parkingspace.service.IPropertyService;
import com.parkingspace.util.Constants;
import com.parkingspace.util.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 物业表 前端控制器
 * </p>
 *
 * @author Gapper
 * @since 2021-05-24
 */
@RestController
@RequestMapping("/property")
public class PropertyController {

	@Resource
	private IPropertyService iPropertyService;

	/**
	 * 查询所有的物业公司
	 * @return 返回List
	 */
	@GetMapping("/findAll")
	public ResultVO findAll() {
		try {
			List<Property> all = iPropertyService.findAll();
			return new ResultVO(Constants.OPER_SUCCESS,"请求成功!",all);
		} catch (Exception e) {
			e.printStackTrace();
			return new ResultVO(Constants.OPER_FAILURE,e.getMessage(),false);
		}
	}

}

